<?php

/**
 * @desc 控制器基类
 * @author keluo <pycorvn@yeah.net>
 */
class SCController {
	public $view;
	public $model;
	public $redirect;
	
	public function __construct() {
		$this->view = SCScabish::core('view');
		$this->model = SCScabish::core('model');
		$this->redirect = SCScabish::core('redirect');
		// @todo 对数据进行过滤……
	}
	
	/**
	 *
	 * 异步返回失败信息
	 * @param string $data 失败信息
	 */
	public function ajaxFail($data = '') {
		die(json_encode(array('__status' => 'fail', 'data' => $data)));
	}
	
	/**
	 *
	 * 异步成功返回数据
	 * @param array $data
	 */
	public function ajaxSuccess($data = '') {
		die(json_encode(array('__status' => 'ok', 'data' => $data)));
	}
}